import axios from '@/libs/api.request'

const prefix = '/web/coach'
const coachApi = {
  pageResult (trainCenter) {
    return axios.request({
      url: prefix + '/pageResult',
      data: trainCenter,
      method: 'post'
    })
  },
  saveOrUpdate (trainCenter) {
    return axios.request({
      url: prefix + '/saveOrUpdate',
      method: 'post',
      data: trainCenter
    })
  },
  unbind (trainCenterId, coachId) {
    return axios.request({
      url: prefix + '/unbind/' + trainCenterId + '/' + coachId,
      method: 'delete'
    })
  },
  userTrainCenterScope () {
    return axios.request({
      url: prefix + '/userTrainCenterScope',
      method: 'get'
    })
  },
  get (id) {
    return axios.request({
      url: prefix + '/' + id,
      method: 'get'
    })
  },
  updateCoachTrainer (trainCenterId, coachId, trainerIds) {
    return axios.request({
      url: prefix + '/coachTrainer',
      data: { 'trainCenterId': trainCenterId, 'coachId': coachId, 'trainerIds': trainerIds },
      method: 'post'
    })
  },
  searchNotJoinedTrainers (data) {
    return axios.request({
      url: prefix + '/notJoinedCoachs/' + data['trainCenterId'],
      data: data,
      method: 'post'
    })
  },
  invite (trainCenterId, trainerId) {
    return axios.request({
      url: prefix + '/invite/' + trainCenterId + '/' + trainerId,
      method: 'post'
    })
  },
  detail (coachId) {
    return axios.request({
      url: prefix + '/detail/' + coachId,
      method: 'get'
    })
  },
  // 查询教练拥有的训练中心列表
  queryCoachTrainCenterList () {
    return axios.request({
      url: prefix + '/trainCenterList',
      method: 'get'
    })
  }

}

export default coachApi
